#include <iostream>
using namespace std;
class Solution {
  private:
    int _year;
    int _month = 1;
    int _day=0;
  public:
    Solution(int year) {
        _year = year;
    }
    int Getmonthday(int year, int month) {
        int Month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))) {
            return 29;
        }
        return Month[month];
    }
    Solution& operator+=(int day) {
        _day += day;
        while (_day > Getmonthday(_year, _month)) {
            _day -= Getmonthday(_year, _month);
            _month++;
            if (_month == 13) {
                _year++;
                _month = 1;
            }
        }
        return *this;
    }
    void print()
    {
        printf("%d-%02d-%02d\n",_year,_month,_day);
    }
};
int main() {
    int year, day;
    cin >> year >> day;
    Solution s(year);
    s+=day;
    s.print();
}